<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head th:replace="~{segmentation/_right_bottom_header::_header_common(~{::title},~{::link},~{::style})}">
    <link rel="stylesheet" th:href="@{/js/custom/common/lay-module/wangEditor/wangEditor.css?v=1.0.0}" media="all">
    <meta charset="utf-8">
    <title>协议查看</title>
    <link>
    <style type="text/css"></style>
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
            <legend>协议查看</legend>
        </fieldset>
        <form class="layui-form" id="protocolFormView" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">协议标题</label>
                <div class="layui-input-block">
                    <span class="view-span" th:text="${p.protocolTitle}"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">协议类型</label>
                <div class="layui-input-block">
                    <span class="view-span" th:each="item : ${@typeServiceImpl.findByParentCodeList('protocolType')}"
                          th:text="${item.typeName}"
                          th:if="${p.protocolType == item.typeValue}"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">协议分类</label>
                <div class="layui-input-block">
                       <span class="view-span"
                             th:each="item : ${@typeServiceImpl.findByParentCodeList('protocolClassification')}"
                             th:text="${item.typeName}"
                             th:if="${p.protocolClassification == item.typeValue}"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">协议内容</label>
                <div class="layui-input-block">
                    <div id="protocolContentEditor" style="height: 500px;"></div>
                    <textarea style="display: none;" name="protocolContent" id="protocolContent"
                              th:text="${p.protocolContent}"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">启用状态</label>
                <div class="layui-input-block">
                    <span class="view-span" th:each="item : ${@typeServiceImpl.findByParentCodeList('enableStatus')}"
                          th:text="${item.typeName}"
                          th:if="${p.enableStatus == item.typeValue}"
                          th:style="${item.typeValue == 1 ? 'color: limegreen;' : 'color: red;' }"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">创建人</label>
                <div class="layui-input-block">
                    <span class="view-span" th:text="${p.createId}"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">创建时间</label>
                <div class="layui-input-block">
                    <span class="view-span" th:text="${#dates.format(p.createTime, 'yyyy-MM-dd HH:mm:ss')}"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">操作人</label>
                <div class="layui-input-block">
                    <span class="view-span" th:text="${p.operaterId}"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">操作时间</label>
                <div class="layui-input-block">
                    <span class="view-span" th:text="${#dates.format(p.operaterTime, 'yyyy-MM-dd HH:mm:ss')}"></span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">操作状态</label>
                <div class="layui-input-block">
                    <span class="view-span" th:each="item : ${@typeServiceImpl.findByParentCodeList('operaterStatus')}"
                          th:text="${item.typeName}"
                          th:if="${p.operaterStatus == item.typeValue}"></span>
                </div>
            </div>
        </form>
    </div>
</div>
<div th:replace="~{segmentation/_tail::_tail_common}"></div>
<script th:inline="javascript">
    /*<![CDATA[*/
    [# sec:authorize="hasPermission(#authorization.authentication,'button','PROTOCOL_LIST_MANAGEMENT:view')"]
    layui.use(['wangEditor'], function () {
        var
            protocolContentHtml = $("#protocolContent").val(),
            wangEditor = layui.wangEditor;


        // 创建编辑器
        var protocolContentEditor = wangEditor.createEditor({
            html: protocolContentHtml,
            selector: '#protocolContentEditor',
            mode: 'default' // 或 'simple' 参考下文
        });
        protocolContentEditor.disable();

    });
    [/]
    /*]]>*/
</script>
</body>
</html>